--
-- Author: yu.yu
-- Date: 2018-11-12 20:36:50
--
-- LotteryDropView

local LotteryDropPanel = import(".LotteryDropPanel")

local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

ClassRef.VIEW_ROOT_RES = Res.LotteryDropScene

function ClassRef:init()
    self.super.init(self)
    display.setCascadeOpacityEnabled(self._root, true)
    self._ui.Button_close:addClickEventListener(function()
        executeFunc(self._onCloseView, self)
    end)

    self._LotteryDropList = self._ui.ListView
    self._oldSize = self._LotteryDropList:getContentSize()
end

function ClassRef:createList(data, str)
    if data then
        for k, v in ipairs(data) do
            local item = LotteryDropPanel.create()
            item:setData(v)
            item:setTipsCloseCallBack(handler(self, self.onTipsCloseCallBack))
            self._LotteryDropList:pushBackCustomItem(item)
        end
    end
    if str then
        self._ui.text:setString(L(str))
    end
end

--隐藏底部的string 同时 listview大小扩大且位置移动
function ClassRef:hideDes()
    self._ui.bg01:setVisible(false)
    self._ui.text:setVisible(false)
    self._LotteryDropList:setContentSize(cc.size(self._oldSize.width,self._oldSize.height+50))
    self._LotteryDropList:setInnerContainerSize(cc.size(self._oldSize.width,self._oldSize.height+50))
    self._LotteryDropList:setPositionY(self._LotteryDropList:getPositionY()-50)
end


function ClassRef:onTipsCloseCallBack(tp)
    if tp == Enums.TIPS_HIDE.GOTO then
		executeFunc(self._onCloseView, self)
	end
end
return ClassRef
